package com.sanjiahantang.youjiarole.module.programmeprice.views.impl;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.sanjiahantang.youjiarole.R;
import com.sanjiahantang.youjiarole.base.BaseMvpActivity;
import com.sanjiahantang.youjiarole.module.programmeprice.presenters.ProgramPricePresenter;
import com.sanjiahantang.youjiarole.module.programmeprice.views.ProgramPriceView;


/**
 * 我的方案增加商品列表
 * 暂时没有用到
 * Created by admin on 2017/10/25.
 */

public class ProgramGoodsListActivity extends BaseMvpActivity<ProgramPriceView, ProgramPricePresenter> implements ProgramPriceView, View.OnClickListener {

    private TextView title;
    private View flLeft, flIcon3;
    private RecyclerView recyclerView;

    private GridLayoutManager gridLayoutManager;

    @Override
    public ProgramPricePresenter initPresenter() {
        return new ProgramPricePresenter();
    }

    @Override
    public void initView() {
        setContentView(R.layout.activity_programgood_list);
        title = (TextView) findViewById(R.id.title);
        findViewById(R.id.fl_Left).setOnClickListener(this);
        gridLayoutManager = new GridLayoutManager(this, 2);
        recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
        recyclerView.setLayoutManager(gridLayoutManager);
        findViewById(R.id.flIcon3).setOnClickListener(this);
        flIcon3 = findViewById(R.id.flIcon3);
        flIcon3.setVisibility(View.VISIBLE);
        flIcon3.setOnClickListener(this);
        title.setText("商品列表");

        presenter.setOnLoadListener(new OnLoadListener() {
            @Override
            public void onLoad(Object content) {
                Object[] param = (Object[]) content;
                switch ((int) param[0]) {
                    case CALLBACK_TYPE_RECYCLER_ADAPTER:
                        recyclerView.setAdapter((RecyclerView.Adapter) param[1]);
                        break;
                }

            }
        });
    }

    @Override
    public void initData() {
        presenter.selectGoodsList(this, "");
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.fl_Left:
                finish();
                break;
//            case R.id.txtjiesuan://结算
//                presenter.checkVersion(this);
//                break;
        }
    }

    @Override
    public void showProgress() {
        super.showProgress($this);
    }

}
